<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>打印一条回溯。</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.debug-backtrace.html">« debug_backtrace</a></li>
      <li style="float: right;"><a href="function.error-clear-last.html">error_clear_last »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.errorfunc.html">错误处理 函数</a></li>
    <li>打印一条回溯。</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.debug-print-backtrace" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">debug_print_backtrace</h1>
    <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">debug_print_backtrace</span> &mdash; <span class="dc-title">
     打印一条回溯。
    </span></p>

   </div>
  
   <div class="refsect1 description" id="refsect1-function.debug-print-backtrace-description">
    <h3 class="title">说明</h3>
    <div class="methodsynopsis dc-description">
     <span class="methodname"><strong>debug_print_backtrace</strong></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$limit</code><span class="initializer"> = 0</span></span>): <span class="type"><span class="type void">void</span></span></div>

    <p class="para rdfs-comment">
     <span class="function"><strong>debug_print_backtrace()</strong></span> 打印了一条 PHP 回溯。它打印了函数调用、被 included/required 的文件和
     <span class="function"><a href="function.eval.html" class="function">eval()</a></span> 的代码。
    </p>
   </div>


 <div class="refsect1 parameters" id="refsect1-function.debug-print-backtrace-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">options</code></dt>

     <dd>

      <p class="para">
       这个参数是以下选项的位掩码：
       <table class="doctable table">
        <caption><strong><span class="function"><strong>debug_print_backtrace()</strong></span> 选项</strong></caption>
        
         <tbody class="tbody">
          <tr>
           <td>DEBUG_BACKTRACE_IGNORE_ARGS</td>
           <td>
            是否忽略 &quot;args&quot; 的索引，包括所有的 function/method 的参数，能够节省内存开销。
           </td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>

    
    
     <dt>
<code class="parameter">limit</code></dt>

     <dd>

      <p class="para">
       这个参数能够用于限制返回堆栈帧的数量。
       默认为 (<code class="parameter">limit</code>=<code class="literal">0</code>) ，返回所有的堆栈帧。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


   <div class="refsect1 returnvalues" id="refsect1-function.debug-print-backtrace-returnvalues">
    <h3 class="title">返回值</h3>
    <p class="para">
     没有返回值。
    </p>
   </div>


   <div class="refsect1 examples" id="refsect1-function.debug-print-backtrace-examples">
    <h3 class="title">范例</h3>
    <p class="para">
     <div class="example" id="example-514">
      <p><strong>示例 #1 <span class="function"><strong>debug_print_backtrace()</strong></span> 范例</strong></p>
      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;include.php&nbsp;file<br /><br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">a</span><span style="color: #007700">()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">b</span><span style="color: #007700">();<br />}<br /><br />function&nbsp;</span><span style="color: #0000BB">b</span><span style="color: #007700">()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">c</span><span style="color: #007700">();<br />}<br /><br />function&nbsp;</span><span style="color: #0000BB">c</span><span style="color: #007700">(){<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">debug_print_backtrace</span><span style="color: #007700">();<br />}<br /><br /></span><span style="color: #0000BB">a</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
      </div>

      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;文件&nbsp;test.php<br />//&nbsp;这是你应该运行的文件<br /><br /></span><span style="color: #007700">include&nbsp;</span><span style="color: #DD0000">'include.php'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

     <div class="example-contents"><p>以上例程的输出类似于：</p></div>
     <div class="example-contents screen">
<div class="cdata"><pre>
#0  c() called at [/tmp/include.php:10]
#1  b() called at [/tmp/include.php:6]
#2  a() called at [/tmp/include.php:17]
#3  include(/tmp/include.php) called at [/tmp/test.php:3]
</pre></div>
     </div>
    </div>
   </p>
  </div>


  <div class="refsect1 seealso" id="refsect1-function.debug-print-backtrace-seealso">
   <h3 class="title">参见</h3>
   <p class="para">
    <ul class="simplelist">
     <li class="member"><span class="function"><a href="function.debug-backtrace.html" class="function" rel="rdfs-seeAlso">debug_backtrace()</a> - 产生一条回溯跟踪(backtrace)</span></li>
    </ul>
   </p>
  </div>

 </div></div></div></body></html>